Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit an error instead of crashing on invalid use of __capability #704

Merged

Conversation

arichardson
Copy link
Member

@arichardson arichardson commented Jun 21, 2023

Emit an error instead of crashing on invalid use of __capability

Previously, attempting to generate code that contained __capability while
using a target without support for CHERI would assert with
Assertion llvm::isPowerOf2_32(Align) && "Alignment must be power of 2"' failed.`
Fix this by emitting a more user-friendly error message instead of crashing
when we encounter __capability but CHERI is not supported.
Ideally we would not expose the keyword for non-CHERI but that is a
rather more invasive change.

@arichardson arichardson requested a review from jrtc27 June 21, 2023 21:53
@arichardson
Copy link
Member Author

I've moved the check to a more sensible location and filed #706 to fix this properly. I think we should still merge this to avoid crashes that are easily triggered by users.

@arichardson arichardson force-pushed the require-cheri-for-__capability branch from a7a2189 to 7092f79 Compare July 5, 2023 18:28
@jrtc27
Copy link
Member

jrtc27 commented Jul 5, 2023

Minor readability nit otherwise LGTM

(Re attribute vs qualifier, I would care were it not for the TODO, but not worth getting right for code that should be removed in future)

Previously, attempting to generate code that contained __capability while
using a target without support for CHERI would assert with
`Assertion `llvm::isPowerOf2_32(Align) && "Alignment must be power of 2"' failed.`
Fix this by emitting a more user-friendly error message instead of crashing
when we encounter __capability but CHERI is not supported.
Ideally we would not expose the keyword for non-CHERI but that is a
rather more invasive change.
Also drop the second non-reduced test for the same issue.
@arichardson arichardson force-pushed the require-cheri-for-__capability branch from 7092f79 to 1f044f6 Compare July 6, 2023 17:19
@arichardson arichardson merged commit e29ddad into CTSRD-CHERI:dev Jul 6, 2023
@arichardson arichardson deleted the require-cheri-for-__capability branch July 6, 2023 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants